home *** CD-ROM | disk | FTP | other *** search
/ SGI Hot Mix 17 / Hot Mix 17.iso / HM17_SGI / research / lib / skey_hp.pro < prev    next >
Text File  |  1997-07-08  |  4KB  |  109 lines

  1. ; $Id: skey_hp.pro,v 1.3 1997/01/15 03:11:50 ali Exp $
  2. ;
  3. ; Copyright (c) 1990-1997, Research Systems, Inc.  All rights reserved.
  4. ;       Unauthorized reproduction prohibited.
  5.  
  6. pro skey_hp,app_keypad=app_keypad,num_keypad=num_keypad
  7. ;+
  8. ; NAME:
  9. ;    SKEY_HP
  10. ;
  11. ; PURPOSE:
  12. ;    Under Unix, the number of function keys, their names, and the
  13. ;    escape sequences they send to the host computer vary
  14. ;    enough between various keyboards that IDL cannot be
  15. ;    written to understand all keyboards. Therefore, it provides
  16. ;    a very general routine named DEFINE_KEY that allows the
  17. ;    user to specify the names and escape sequences. This
  18. ;    routine uses DEFINE_KEY to enter the keys for the HP 9000
  19. ;    series 300 keyboard.
  20. ;
  21. ;    Note: SKEY_HP is primarily designed to be called by
  22. ;    SETUP_KEYS, which attempts to automatically detect the correct
  23. ;    keyboard type in use, and define the keys accordingly.
  24. ;    Nonetheless, SKEY_HP can be called as a standalone
  25. ;    routine.
  26. ;
  27. ; CATEGORY:
  28. ;    Misc.
  29. ;
  30. ; CALLING SEQUENCE:
  31. ;    SKEY_HP
  32. ;
  33. ; INPUTS:
  34. ;    None.
  35. ;
  36. ; KEYWORD PARAMETERS:
  37. ;  APP_KEYPAD:    Defines escape sequences for the group of keys
  38. ;        in the numeric keypad, enabling these keys to be programmed
  39. ;        within IDL.
  40. ;
  41. ;  NUM_KEYPAD:    Disables programmability of the numeric keypad.
  42. ;
  43. ; OUTPUTS:
  44. ;    None.
  45. ;
  46. ; COMMON BLOCKS:
  47. ;    None.
  48. ;
  49. ; SIDE EFFECTS:
  50. ;    The definitions for the function keys have been entered, and
  51. ;    can be viewed using HELP,/KEYS .
  52. ;
  53. ;    The upper right-hand group of four keys (at the same height as
  54. ;    the function keys) are called "BLANK1" through "BLANK4", since
  55. ;    they have no written labels.  Keys defined to have labels beginning
  56. ;    with a capital "K" belong to the numeric keypad group.  For example,
  57. ;    "K9" refers to keypad key "9".
  58. ;
  59. ;    Although the HP 9000 series 300 can create both xterm and hpterm
  60. ;    windows, IDL supports only user-definable key definitions in xterm
  61. ;    windows - hpterm windows use non-standard escape sequences which
  62. ;    IDL does not attempt to handle.
  63. ;
  64. ; MODIFICATION HISTORY:
  65. ;    TJA & AB, July 1990, setup_keys_hp created, and call to setup_keys_hp
  66. ;        placed in procedure setup_keys
  67. ;    AB, 21 September 1992,renamed from SETUP_KEYS_HP to SKEY_HP to
  68. ;        avoid DOS filename limitations.
  69. ;    AB, 16 June 1993, The IDL scanner used to treat octal string escapes
  70. ;        in a manner similar to the C language, but this ability was
  71. ;        removed to make the MS DOS port possible (conflicts with
  72. ;        file path specifications). Removed all uses of that here.
  73. ;-
  74. if (keyword_set(app_keypad)) then print,string(byte([27,61])) ; Enable keypad
  75. if (keyword_set(num_keypad)) then print,string(byte([27,62])) ; Disable keypad
  76. esc = string(27B)
  77. newl = string(13B)
  78. ; Top row of function keys
  79. fkeys='12345678'
  80. fvals='12345789' ; Not a mistake - no 6!
  81. for i=1,8 do define_key,'F'+strmid(fkeys,(i-1),1), $
  82.              escape=esc+'[1'+strmid(fvals,(i-1),1)+'~'
  83. ; Menu key on top row
  84. define_key,'MENU',escape=esc+'[29~'
  85. ; Upper righthand "unlabelled" keys (same height as the function keys)
  86. bkeys='1234'
  87. bvals='0134'  ; No 2!
  88. for i=1,4 do define_key,'BLANK'+strmid(bkeys,(i-1),1), $
  89.              escape=esc+'[2'+strmid(bvals,(i-1),1)+'~'
  90. ; Labelled keys near the Return key
  91. define_key,'PREV',escape=esc+'[5~'
  92. define_key,'SELECT',escape=esc+'[4~'
  93. define_key,'NEXT',escape=esc+'[6~'
  94. ; Numeric keypad - This only works if application keypad is enabled!
  95. define_key,'K*',escape=esc+'Oj'
  96. define_key,'K/',escape=esc+'Oo'
  97. define_key,'K+',escape=esc+'Ok'
  98. define_key,'K-',escape=esc+'Om'
  99. define_key,'K_ENTER',escape=esc+'OM'
  100. nkeys='0123456789'
  101. nvals='pqrstuvwxy'
  102. for i=0,9 do define_key,'K'+strmid(nkeys,i,1), $
  103.              escape=esc+'O'+strmid(nvals,i,1)
  104. define_key,'K,',escape=esc+'Ol'
  105. define_key,'K_TAB',escape=esc+'OI'
  106. define_key,'K.',escape=esc+'On'
  107. return ; HP 9000 Series 300 keyboard (xterm only)
  108. end
  109.